<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>MiXiM: D:/Projects/MiXiM/extsrc/mixim/src/inet_stub/mobility/models/PostureTransition.h Source File</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>


</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">MiXiM
   &#160;<span id="projectnumber">2.3</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li><a href="dirs.html"><span>Directories</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('a00371.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="headertitle">
<div class="title">PostureTransition.h</div>  </div>
</div>
<div class="contents">
<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* -*- mode:c++ -*- ********************************************************</span>
<a name="l00002"></a>00002 <span class="comment"> * file:        PostureTransition.h</span>
<a name="l00003"></a>00003 <span class="comment"> *</span>
<a name="l00004"></a>00004 <span class="comment"> * author:      Majid Nabi &lt;m.nabi@tue.nl&gt;</span>
<a name="l00005"></a>00005 <span class="comment"> *</span>
<a name="l00006"></a>00006 <span class="comment"> *</span>
<a name="l00007"></a>00007 <span class="comment"> *              http://www.es.ele.tue.nl/nes</span>
<a name="l00008"></a>00008 <span class="comment"> *</span>
<a name="l00009"></a>00009 <span class="comment"> * copyright:   (C) 2010 Electronic Systems group(ES),</span>
<a name="l00010"></a>00010 <span class="comment"> *              Eindhoven University of Technology (TU/e), the Netherlands.</span>
<a name="l00011"></a>00011 <span class="comment"> *</span>
<a name="l00012"></a>00012 <span class="comment"> *</span>
<a name="l00013"></a>00013 <span class="comment"> *              This program is free software; you can redistribute it</span>
<a name="l00014"></a>00014 <span class="comment"> *              and/or modify it under the terms of the GNU General Public</span>
<a name="l00015"></a>00015 <span class="comment"> *              License as published by the Free Software Foundation; either</span>
<a name="l00016"></a>00016 <span class="comment"> *              version 2 of the License, or (at your option) any later</span>
<a name="l00017"></a>00017 <span class="comment"> *              version.</span>
<a name="l00018"></a>00018 <span class="comment"> *              For further information see file COPYING</span>
<a name="l00019"></a>00019 <span class="comment"> *              in the top level directory</span>
<a name="l00020"></a>00020 <span class="comment"> ***************************************************************************</span>
<a name="l00021"></a>00021 <span class="comment"> * part of:    MoBAN (Mobility Model for wireless Body Area Networks)</span>
<a name="l00022"></a>00022 <span class="comment"> * description: A class to manage and store the posture transition matrices</span>
<a name="l00023"></a>00023 <span class="comment"> ***************************************************************************</span>
<a name="l00024"></a>00024 <span class="comment"> * Citation of the following publication is appreciated if you use MoBAN for</span>
<a name="l00025"></a>00025 <span class="comment"> * a publication of your own.</span>
<a name="l00026"></a>00026 <span class="comment"> *</span>
<a name="l00027"></a>00027 <span class="comment"> * M. Nabi, M. Geilen, T. Basten. MoBAN: A Configurable Mobility Model for Wireless Body Area Networks.</span>
<a name="l00028"></a>00028 <span class="comment"> * In Proc. of the 4th Int&#39;l Conf. on Simulation Tools and Techniques, SIMUTools 2011, Barcelona, Spain, 2011.</span>
<a name="l00029"></a>00029 <span class="comment"> *</span>
<a name="l00030"></a>00030 <span class="comment"> * BibTeX:</span>
<a name="l00031"></a>00031 <span class="comment"> *        @inproceedings{MoBAN,</span>
<a name="l00032"></a>00032 <span class="comment"> *         author = &quot;M. Nabi and M. Geilen and T. Basten.&quot;,</span>
<a name="l00033"></a>00033 <span class="comment"> *          title = &quot;{MoBAN}: A Configurable Mobility Model for Wireless Body Area Networks.&quot;,</span>
<a name="l00034"></a>00034 <span class="comment"> *        booktitle = &quot;Proceedings of the 4th Int&#39;l Conf. on Simulation Tools and Techniques.&quot;,</span>
<a name="l00035"></a>00035 <span class="comment"> *        series = {SIMUTools &#39;11},</span>
<a name="l00036"></a>00036 <span class="comment"> *        isbn = {978-963-9799-41-7},</span>
<a name="l00037"></a>00037 <span class="comment"> *        year = {2011},</span>
<a name="l00038"></a>00038 <span class="comment"> *        location = {Barcelona, Spain},</span>
<a name="l00039"></a>00039 <span class="comment"> *        publisher = {ICST} }</span>
<a name="l00040"></a>00040 <span class="comment"> *</span>
<a name="l00041"></a>00041 <span class="comment"> **************************************************************************/</span>
<a name="l00042"></a>00042 
<a name="l00043"></a>00043 
<a name="l00044"></a>00044 <span class="preprocessor">#ifndef POSTURE_TRANSITION_H</span>
<a name="l00045"></a>00045 <span class="preprocessor"></span><span class="preprocessor">#define POSTURE_TRANSITION_H</span>
<a name="l00046"></a>00046 <span class="preprocessor"></span>
<a name="l00047"></a>00047 <span class="preprocessor">#include &lt;iostream&gt;</span>
<a name="l00048"></a>00048 <span class="preprocessor">#include &lt;sstream&gt;</span>
<a name="l00049"></a>00049 
<a name="l00050"></a>00050 <span class="preprocessor">#include &quot;INETDefs.h&quot;</span>
<a name="l00051"></a>00051 
<a name="l00052"></a>00052 <span class="preprocessor">#include &quot;Coord.h&quot;</span>
<a name="l00053"></a>00053 
<a name="l00054"></a>00054 
<a name="l00068"></a><a class="code" href="a00179.html">00068</a> <span class="keyword">class </span><a class="code" href="a00179.html" title="Class to provide spatial and temporal correlation in the posture selection process of the MoBAN mobil...">PostureTransition</a> {
<a name="l00069"></a>00069   <span class="keyword">protected</span>:
<a name="l00071"></a><a class="code" href="a00179.html#a88d4a9fb3d68fb6792ebade157067d73">00071</a>     <span class="keywordtype">int</span> <a class="code" href="a00179.html#a88d4a9fb3d68fb6792ebade157067d73" title="Number of postures.">numPos</a>;
<a name="l00072"></a>00072 
<a name="l00077"></a><a class="code" href="a00179.html#ae24e4f7a9dc7453d935b87669a0edf24">00077</a>     <span class="keywordtype">int</span> <a class="code" href="a00179.html#ae24e4f7a9dc7453d935b87669a0edf24" title="The index of the default (base) transition matrix. If no default is set, the first matrix is supposed...">defaultMatrixID</a>;
<a name="l00078"></a>00078 
<a name="l00080"></a><a class="code" href="a00218.html">00080</a>     <span class="keyword">typedef</span> <span class="keyword">struct</span>{
<a name="l00081"></a>00081         std::string name;
<a name="l00082"></a>00082         <span class="keywordtype">double</span>** matrix;
<a name="l00083"></a>00083     }<a class="code" href="a00218.html" title="Data type for one instance of Markov transition matrix.">TransMatrix</a>;
<a name="l00084"></a>00084 
<a name="l00086"></a><a class="code" href="a00179.html#a7c9e0f2800e1fa2b681ed55c07eb8046">00086</a>     <span class="keyword">typedef</span> std::vector&lt;TransMatrix*&gt; <a class="code" href="a00179.html#a7c9e0f2800e1fa2b681ed55c07eb8046" title="Data type for a list of Markov transition matrices.">TransMatrixList</a>;
<a name="l00087"></a>00087 
<a name="l00089"></a><a class="code" href="a00179.html#a16d12fd657a13f5a43f5b9d1dd6fea7a">00089</a>     <a class="code" href="a00179.html#a7c9e0f2800e1fa2b681ed55c07eb8046" title="Data type for a list of Markov transition matrices.">TransMatrixList</a> <a class="code" href="a00179.html#a16d12fd657a13f5a43f5b9d1dd6fea7a" title="The list of all given transition matrices.">matrixList</a>;
<a name="l00090"></a>00090 
<a name="l00092"></a><a class="code" href="a00011.html">00092</a>     <span class="keyword">typedef</span> <span class="keyword">struct</span>{
<a name="l00093"></a>00093         <a class="code" href="a00065.html" title="Class for storing 3D coordinates.">Coord</a> low;
<a name="l00094"></a>00094         <a class="code" href="a00065.html" title="Class for storing 3D coordinates.">Coord</a> high;
<a name="l00095"></a>00095     }<a class="code" href="a00011.html" title="Data type for one instance of the area (space) boundary.">AreaBound</a>;
<a name="l00096"></a>00096 
<a name="l00098"></a><a class="code" href="a00012.html">00098</a>     <span class="keyword">typedef</span> <span class="keyword">struct</span>{
<a name="l00099"></a>00099          std::string name;
<a name="l00100"></a>00100           std::vector&lt;AreaBound*&gt; boundries;
<a name="l00101"></a>00101     }<a class="code" href="a00012.html" title="Data type for one instance of area type.">AreaType</a>;
<a name="l00102"></a>00102 
<a name="l00104"></a><a class="code" href="a00179.html#a98b2ed7203b32614bd82d29079db59cc">00104</a>     <span class="keyword">typedef</span> std::vector&lt;AreaType*&gt; <a class="code" href="a00179.html#a98b2ed7203b32614bd82d29079db59cc" title="Data type for the list of area types.">AreaTypeList</a>;
<a name="l00105"></a>00105 
<a name="l00107"></a><a class="code" href="a00179.html#a438b1e6813a28c3b9b49ae4ecef1b937">00107</a>     <a class="code" href="a00179.html#a98b2ed7203b32614bd82d29079db59cc" title="Data type for the list of area types.">AreaTypeList</a> <a class="code" href="a00179.html#a438b1e6813a28c3b9b49ae4ecef1b937" title="The list of all defined area types.">areaTypeList</a>;
<a name="l00108"></a>00108 
<a name="l00110"></a><a class="code" href="a00210.html">00110</a>     <span class="keyword">typedef</span> <span class="keyword">struct</span>{
<a name="l00111"></a>00111         simtime_t low;
<a name="l00112"></a>00112         simtime_t high;
<a name="l00113"></a>00113     }<a class="code" href="a00210.html" title="Data type for one instance of the time boundary.">TimeBound</a>;
<a name="l00114"></a>00114 
<a name="l00116"></a><a class="code" href="a00211.html">00116</a>     <span class="keyword">typedef</span> <span class="keyword">struct</span>{
<a name="l00117"></a>00117            std::string name;
<a name="l00118"></a>00118            std::vector&lt;TimeBound*&gt; boundries;
<a name="l00119"></a>00119     }<a class="code" href="a00211.html" title="Data type for one instance of time domain.">TimeDomainType</a>;
<a name="l00120"></a>00120 
<a name="l00122"></a><a class="code" href="a00179.html#a867c3cd2530e28d6f2953508a700ffec">00122</a>     <span class="keyword">typedef</span> std::vector&lt;TimeDomainType*&gt; <a class="code" href="a00179.html#a867c3cd2530e28d6f2953508a700ffec" title="Data type for the list of time domains.">TimeDomainList</a>;
<a name="l00123"></a>00123 
<a name="l00125"></a><a class="code" href="a00179.html#a0566260a55d34fde7d6e35103f95785a">00125</a>     <a class="code" href="a00179.html#a867c3cd2530e28d6f2953508a700ffec" title="Data type for the list of time domains.">TimeDomainList</a> <a class="code" href="a00179.html#a0566260a55d34fde7d6e35103f95785a" title="The list of all defined time domains.">timeDomainList</a>;
<a name="l00126"></a>00126 
<a name="l00128"></a><a class="code" href="a00048.html">00128</a>     <span class="keyword">typedef</span> <span class="keyword">struct</span>{
<a name="l00129"></a>00129         <span class="keywordtype">int</span> timeID;
<a name="l00130"></a>00130         <span class="keywordtype">int</span> areaID;
<a name="l00131"></a>00131         <span class="keywordtype">int</span> matrixID;
<a name="l00132"></a>00132     }<a class="code" href="a00048.html" title="Data type for one instance of space-time combination.">CombinationType</a>;
<a name="l00133"></a>00133 
<a name="l00135"></a><a class="code" href="a00179.html#a03a03987992fffd49db8174cf6e83953">00135</a>     <span class="keyword">typedef</span> std::vector&lt;CombinationType*&gt; <a class="code" href="a00179.html#a03a03987992fffd49db8174cf6e83953" title="Data type for the list of space-time combinations.">CombinationList</a>;
<a name="l00136"></a>00136 
<a name="l00138"></a><a class="code" href="a00179.html#ab4afd59bcc62d7e198bebff13c873746">00138</a>     <a class="code" href="a00179.html#a03a03987992fffd49db8174cf6e83953" title="Data type for the list of space-time combinations.">CombinationList</a> <a class="code" href="a00179.html#ab4afd59bcc62d7e198bebff13c873746" title="The list of all given space-time combinations.">combinationList</a>;
<a name="l00139"></a>00139 
<a name="l00143"></a>00143     <span class="keywordtype">double</span>** <a class="code" href="a00179.html#a3ddddcbf58ad8e1edd23cf8023c7b974" title="Gets a steady state vector and return a matrix which is as close as posible to the default matrix and...">extractMatrixFromSteadyState</a>(<span class="keywordtype">double</span>*);
<a name="l00144"></a>00144 
<a name="l00146"></a>00146     <span class="keywordtype">int</span> <a class="code" href="a00179.html#ae252301f9e6668f04fad293321f55066" title="Gets a time and finds the ID of the containing time domain if there is. If not, return -1...">findTimeDomain</a>(simtime_t);
<a name="l00147"></a>00147 
<a name="l00149"></a>00149     <span class="keywordtype">int</span> <a class="code" href="a00179.html#a299b33afdc27f467b3cdd472a397bb5a" title="Gets a location and finds the ID of the containing area type if there is. If not, return -1...">findAreaType</a>(<a class="code" href="a00065.html" title="Class for storing 3D coordinates.">Coord</a>);
<a name="l00150"></a>00150 
<a name="l00154"></a>00154     <span class="keywordtype">bool</span> <a class="code" href="a00179.html#abe806a2afdeb239694094c24446f699f" title="Checks if a matrix can be a Markov transition matrix. All elements should be in the range [0...">isMarkovian</a>(<span class="keywordtype">double</span>**);
<a name="l00155"></a>00155 
<a name="l00159"></a>00159     <span class="keywordtype">bool</span> <a class="code" href="a00179.html#abe806a2afdeb239694094c24446f699f" title="Checks if a matrix can be a Markov transition matrix. All elements should be in the range [0...">isMarkovian</a>(<span class="keywordtype">double</span>*);
<a name="l00160"></a>00160 
<a name="l00162"></a>00162     <span class="keywordtype">void</span> <a class="code" href="a00179.html#abe7336508b8864deeb66872425662587" title="Multiplies two matrices with dimension numPos*numPose .">multMatrix</a>(<span class="keywordtype">double</span>**, <span class="keywordtype">double</span>**, <span class="keywordtype">double</span>**);
<a name="l00163"></a>00163 
<a name="l00165"></a>00165     <span class="keywordtype">void</span> <a class="code" href="a00179.html#a10abfb612543bbc52f6a13a0e138d822" title="Adds two matrices with dimension numPos*numPose .">addMatrix</a>(<span class="keywordtype">double</span>**, <span class="keywordtype">double</span>**, <span class="keywordtype">double</span>**);
<a name="l00166"></a>00166 
<a name="l00168"></a>00168     <span class="keywordtype">void</span> <a class="code" href="a00179.html#af48e8ee3a857b2425a9f1fe6ded08841" title="Subtracts two matrices with dimension numPos*numPose .">subtractMatrix</a>(<span class="keywordtype">double</span>**, <span class="keywordtype">double</span>**, <span class="keywordtype">double</span>**);
<a name="l00169"></a>00169 
<a name="l00171"></a>00171     <span class="keywordtype">void</span> <a class="code" href="a00179.html#a2781afe68489f9278e755429787b22ec" title="Multiply a vector of size numPos with its transpose.">multVector</a>(<span class="keywordtype">double</span>*, <span class="keywordtype">double</span>**);
<a name="l00172"></a>00172 
<a name="l00173"></a>00173   <span class="keyword">public</span>:
<a name="l00177"></a>00177     <a class="code" href="a00179.html#a4b10c46a88e6be413c7395c06bf65380" title="Construct a posture transition object. The parameter is the number of postures which is the dimension...">PostureTransition</a>(<span class="keywordtype">int</span>);
<a name="l00178"></a>00178 
<a name="l00180"></a>00180     <span class="keywordtype">int</span> <a class="code" href="a00179.html#a10abfb612543bbc52f6a13a0e138d822" title="Adds two matrices with dimension numPos*numPose .">addMatrix</a>(std::string, <span class="keywordtype">double</span>**, <span class="keywordtype">bool</span>);
<a name="l00181"></a>00181 
<a name="l00185"></a>00185     <span class="keywordtype">int</span> <a class="code" href="a00179.html#ac5c424a8372a3d6f39ccc06c88d4249f" title="Receives a steady state vector, extracts the corresponding transition matrix considering the default ...">addSteadyState</a>(std::string, <span class="keywordtype">double</span>*);
<a name="l00186"></a>00186 
<a name="l00188"></a>00188     <span class="keywordtype">int</span> <a class="code" href="a00179.html#a261ad915b2a9c7cdf7082660360190e4" title="Adds a area type to the list with the given name and returns the index of this area type in the list...">addAreaType</a>(std::string);
<a name="l00189"></a>00189 
<a name="l00191"></a>00191     <span class="keywordtype">bool</span> <a class="code" href="a00179.html#a309ed6acf7eca6469f0ea0f06ee41780" title="Adds the given boundary to the existing area type specified by the given ID .">setAreaBoundry</a>(<span class="keywordtype">int</span>, <a class="code" href="a00065.html" title="Class for storing 3D coordinates.">Coord</a>, <a class="code" href="a00065.html" title="Class for storing 3D coordinates.">Coord</a>);
<a name="l00192"></a>00192 
<a name="l00194"></a>00194     <span class="keywordtype">int</span> <a class="code" href="a00179.html#a58c7924dfb8810ba37311217a7ba5c8d" title="Adds a time domain to the list with the given name and returns the index of the this time domain in t...">addTimeDomain</a>(std::string);
<a name="l00195"></a>00195 
<a name="l00197"></a>00197     <span class="keywordtype">bool</span> <a class="code" href="a00179.html#af66d8f9dda835d55dc3009cf582f87d8" title="Adds the given boundary to the existing time domain specified by the given ID .">setTimeBoundry</a>(<span class="keywordtype">int</span>, simtime_t, simtime_t);
<a name="l00198"></a>00198 
<a name="l00200"></a>00200     <span class="keywordtype">bool</span> <a class="code" href="a00179.html#a5b4ab00961c0039aac63143d28e88272" title="Adds a space-time combination to the list.">addCombination</a>(std::string, std::string, std::string);
<a name="l00201"></a>00201 
<a name="l00203"></a>00203     <span class="keywordtype">double</span>** <a class="code" href="a00179.html#a1f04b24b643026f15fbc95d175429c5f" title="Gets a time and location, and returns the corresponding Markov transition matrix.">getMatrix</a>(simtime_t, <a class="code" href="a00065.html" title="Class for storing 3D coordinates.">Coord</a>);
<a name="l00204"></a>00204 };
<a name="l00205"></a>00205 
<a name="l00206"></a>00206 <span class="preprocessor">#endif</span>
</pre></div></div>
</div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><b>PostureTransition.h</b>      </li>

    <li class="footer">Generated on Tue Mar 5 2013 21:26:30 for MiXiM by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.5.1 </li>
   </ul>
 </div>


</body>
</html>
